-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: clear anonymous user records after login #48144
Conversation
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid-app-2024-09-05_11.00.34.mp4Android: mWeb Chromeandroid-chrome-2024-09-05_11.20.58.mp4iOS: Nativeios-app-2024-09-05_11.38.22.mp4iOS: mWeb Safariios-safari-2024-09-05_11.36.09.mp4MacOS: Chrome / Safaridesktop-chrome-2024-09-05_10.42.24.mp4MacOS: Desktopdesktop-app-2024-09-05_10.50.27.mp4 |
/** | ||
* Create Onyx update to clean up anonymous user data | ||
*/ | ||
function buildOnyxDataToCleanUpAnonymousUser() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this if we have the anonymous session (and therefore the accountID
) just before logging in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before this fix, there's a potential case where user:
- Access the public room -> create anonymous record 1
- Login then logout
- Access the public room again -> create anonymous record 2
-> It's better to clear both records, no?
Also, I think it's a more holistic approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see your point! Just thinking though, don't we clear all Onyx data on logging out, so all those hypothetical extra anonymous records would get cleared on next log-out anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jjcoffee hmm 🤔 , I'll give it a thought and let you know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
NAB, just to make it clearer the first test step would be better as "Open any public room, e.g. ..." |
@dominictb Any thoughts on this? |
@jjcoffee I didn't get this issue even with the strict mode on, but does that mean we should clear all anonymous personal details, not only the one introduced by |
@dominictb Huh that's strange that it's not happening for you too! Is there any reason we can't just empty the whole |
Okay, lemme revert the latest change and let you know. |
this is also possible, but I prefer the safer approach, i.e: cleaning only anonymous records. |
@jjcoffee let me know what you think. |
@dominictb My only concern is that it could be a bit wasteful to loop through all of Asking on Slack to see if anyone knows if there's a reason we don't do this 😄 |
Okay so after a bit more testing, it looks like the duplicate I think the reason you weren't seeing the behaviour with strict mode enabled is that you have to completely clear the Onyx store before refreshing in order to get this behaviour. I'll complete the review today, sorry for delaying it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
src/CONST.ts
Outdated
@@ -1340,6 +1340,7 @@ const CONST = { | |||
STUDENT_AMBASSADOR: '[email protected]', | |||
SVFG: '[email protected]', | |||
EXPENSIFY_EMAIL_DOMAIN: '@expensify.com', | |||
ANONYMOUS_USER_DOMAIN: '@expensify.anon', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ANONYMOUS_USER_DOMAIN: '@expensify.anon', |
Oops! Forgot to suggest this tidy up since we're not using this any more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
import type Session from '@src/types/onyx/Session'; | ||
import type {AutoAuthState} from '@src/types/onyx/Session'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB - was this just a prettier / style thing?
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/dangrous in version: 9.0.30-0 🚀
|
Details
Fixed Issues
$ #47806
PROPOSAL: #47806 (comment)
Tests
Verify that there's no guest user in the contact section
Offline tests
QA Steps
Verify that there's no guest user in the contact section
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
compressed_android.webm.mp4
Android: mWeb Chrome
compressed_aweb.webm.mp4
iOS: Native
compressed_ios.mp4.mp4
iOS: mWeb Safari
compressed_iosweb.mp4.mp4
MacOS: Chrome / Safari
compressed_web.mov.mp4
MacOS: Desktop
compressed_web.mov.mp4